<template>
    <div class="sys-page">
        <div class="sys-search">
            <template v-if="showEdit">
                <emp-edit></emp-edit>
            </template>
            <template v-else>
                <emp-search></emp-search>
            </template>
        </div>
    </div>
</template>

<script>
    import { mapState, mapActions } from 'vuex'
    import EmpEdit from './emp_edit'
    import EmpSearch from './emp_search'

    export default {
        name: "emp",
        components: {EmpEdit, EmpSearch},

        mounted() {
            this.fetchDeptTreeData();
            this.fetchDropdownValues();
        },

        methods: {
            ...mapActions({
                fetchDeptTreeData: 'dept/fetchDeptTreeData',
                fetchDropdownValues: 'emp/fetchDropdownValues',
            }),
        },

        computed: {
            ...mapState({
                showEdit: state => state.emp.showEdit
            })
        }

    }
</script>

